<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .first-com {
           border: 1px solid orange;
        }
        .header {
           border: 1px solid red;
        }
        .main {
           border: 1px solid darkcyan;
        }
        .footer {
           border: 1px solid darkorchid;
        }
    </style>
</head>

<body>
    <div id="div">
        <first-com>
<!-- v-bind :  v-on @   v-slot # -->
            <template #header>
                <div>
                    <h1>头部</h1>
                </div>
            </template>
            <template #default>
                <div>
                    <h1>默认插槽</h1>
                </div>
            </template>
            <template v-slot:footer>
                <div>
                    <h1>Footer</h1>
                </div>
            </template>

        </first-com>
    </div>

    <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/axios/1.3.4/axios.min.js"></script>

    <script>
        //app本生也是组件，根(root)组件
        const app = Vue.createApp({
            data() {
                return {
                    num: 0,
                }
            }

        });
        app.component('FirstCom', {
            template: `
            <div class="first-com">
                <header class="header">
                  <slot name="header"></slot>
                </header>
                <main class="main">
                    <slot></slot>
                </main>
                <footer class="footer">
                    <slot name="footer"></slot>
                </footer>
                <slot></slot>
            </div>

            `,
        });

        app.mount('#div')

    </script>

</body>

</html>